﻿Module CliProgresBar
    Public Sub DrawProgresBar()
        Console.SetCursorPosition(0, 0)
        Console.Write("┌")
        Console.Write(New String("─", Console.WindowWidth - 2))
        Console.Write("┐")

        Console.SetCursorPosition(0, 1)
        Console.Write("│")
        Console.SetCursorPosition(Console.WindowWidth - 1, 1)
        Console.Write("│")

        Console.SetCursorPosition(0, 2)
        Console.Write("└")
        Console.Write(New String("─", Console.WindowWidth - 2))
        Console.Write("┘")

        'Console.SetCursorPosition(Console.WindowWidth - 6, 1)
        'Console.Write("   ")
    End Sub

    Public Sub UpdateProgresBar(Percent As Integer, clr As ConsoleColor) '█▓▒░
        SetConsoleColors(clr)
        'Dim O As Integer
        'If Percent >= 0 And Percent < 10 Then O = 4
        'If Percent >= 10 And Percent < 100 Then O = 5
        'If Percent = 100 Then O = 6

        'Console.SetCursorPosition(Console.WindowWidth - O, 1)
        'Console.Write(Percent)
        'Console.SetCursorPosition(Console.WindowWidth - 2, 1)
        'Console.Write("%")
        Console.SetCursorPosition(1, 1)
        Dim i As Integer = Convert.ToInt32((Percent / 100) * (Console.WindowWidth - 2)) '-7
        Console.Write(New String("▒", i))
    End Sub
End Module
